{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "627a12db-5481-4d8b-a1c8-7f6620521e7a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com\n",
      "Collecting tensorflow\n",
      "  Downloading tensorflow-2.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.1 kB)\n",
      "Requirement already satisfied: absl-py>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (2.1.0)\n",
      "Requirement already satisfied: astunparse>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.6.3)\n",
      "Collecting flatbuffers>=24.3.25 (from tensorflow)\n",
      "  Downloading flatbuffers-24.3.25-py2.py3-none-any.whl.metadata (850 bytes)\n",
      "Requirement already satisfied: gast!=0.5.0,!=0.5.1,!=0.5.2,>=0.2.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (0.5.4)\n",
      "Collecting google-pasta>=0.1.1 (from tensorflow)\n",
      "  Downloading google_pasta-0.2.0-py3-none-any.whl.metadata (814 bytes)\n",
      "Collecting libclang>=13.0.0 (from tensorflow)\n",
      "  Downloading libclang-18.1.1-py2.py3-none-manylinux2010_x86_64.whl.metadata (5.2 kB)\n",
      "Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (3.3.0)\n",
      "Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from tensorflow) (23.2)\n",
      "Requirement already satisfied: protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<6.0.0dev,>=3.20.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (4.24.4)\n",
      "Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (2.31.0)\n",
      "Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from tensorflow) (68.2.2)\n",
      "Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.16.0)\n",
      "Collecting termcolor>=1.1.0 (from tensorflow)\n",
      "  Downloading termcolor-2.5.0-py3-none-any.whl.metadata (6.1 kB)\n",
      "Requirement already satisfied: typing-extensions>=3.6.6 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (4.10.0)\n",
      "Collecting wrapt>=1.11.0 (from tensorflow)\n",
      "  Downloading wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)\n",
      "Requirement already satisfied: grpcio<2.0,>=1.24.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow) (1.62.1)\n",
      "Collecting tensorboard<2.19,>=2.18 (from tensorflow)\n",
      "  Downloading tensorboard-2.18.0-py3-none-any.whl.metadata (1.6 kB)\n",
      "Collecting keras>=3.5.0 (from tensorflow)\n",
      "  Downloading keras-3.6.0-py3-none-any.whl.metadata (5.8 kB)\n",
      "Collecting numpy<2.1.0,>=1.26.0 (from tensorflow)\n",
      "  Downloading numpy-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (60 kB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m60.9/60.9 kB\u001b[0m \u001b[31m13.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hCollecting h5py>=3.11.0 (from tensorflow)\n",
      "  Downloading h5py-3.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.5 kB)\n",
      "Collecting ml-dtypes<0.5.0,>=0.4.0 (from tensorflow)\n",
      "  Downloading ml_dtypes-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (20 kB)\n",
      "Collecting tensorflow-io-gcs-filesystem>=0.23.1 (from tensorflow)\n",
      "  Downloading tensorflow_io_gcs_filesystem-0.37.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (14 kB)\n",
      "Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from astunparse>=1.6.0->tensorflow) (0.43.0)\n",
      "Requirement already satisfied: rich in /usr/local/lib/python3.10/dist-packages (from keras>=3.5.0->tensorflow) (13.7.1)\n",
      "Collecting namex (from keras>=3.5.0->tensorflow)\n",
      "  Downloading namex-0.0.8-py3-none-any.whl.metadata (246 bytes)\n",
      "Requirement already satisfied: optree in /usr/local/lib/python3.10/dist-packages (from keras>=3.5.0->tensorflow) (0.11.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorflow) (3.3.2)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorflow) (3.6)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorflow) (1.26.18)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorflow) (2024.2.2)\n",
      "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.19,>=2.18->tensorflow) (3.6)\n",
      "Collecting tensorboard-data-server<0.8.0,>=0.7.0 (from tensorboard<2.19,>=2.18->tensorflow)\n",
      "  Downloading tensorboard_data_server-0.7.2-py3-none-manylinux_2_31_x86_64.whl.metadata (1.1 kB)\n",
      "Requirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.19,>=2.18->tensorflow) (3.0.2)\n",
      "Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.10/dist-packages (from werkzeug>=1.0.1->tensorboard<2.19,>=2.18->tensorflow) (2.1.5)\n",
      "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.10/dist-packages (from rich->keras>=3.5.0->tensorflow) (3.0.0)\n",
      "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.10/dist-packages (from rich->keras>=3.5.0->tensorflow) (2.17.2)\n",
      "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.10/dist-packages (from markdown-it-py>=2.2.0->rich->keras>=3.5.0->tensorflow) (0.1.2)\n",
      "Downloading tensorflow-2.18.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (615.3 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m615.3/615.3 MB\u001b[0m \u001b[31m255.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
      "\u001b[?25hDownloading flatbuffers-24.3.25-py2.py3-none-any.whl (26 kB)\n",
      "Downloading google_pasta-0.2.0-py3-none-any.whl (57 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.5/57.5 kB\u001b[0m \u001b[31m233.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading h5py-3.12.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.3/5.3 MB\u001b[0m \u001b[31m277.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading keras-3.6.0-py3-none-any.whl (1.2 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.2/1.2 MB\u001b[0m \u001b[31m339.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading libclang-18.1.1-py2.py3-none-manylinux2010_x86_64.whl (24.5 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m24.5/24.5 MB\u001b[0m \u001b[31m294.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading ml_dtypes-0.4.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.2 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m2.2/2.2 MB\u001b[0m \u001b[31m323.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading numpy-2.0.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (19.5 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m19.5/19.5 MB\u001b[0m \u001b[31m250.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading tensorboard-2.18.0-py3-none-any.whl (5.5 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.5/5.5 MB\u001b[0m \u001b[31m279.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading tensorflow_io_gcs_filesystem-0.37.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.1 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.1/5.1 MB\u001b[0m \u001b[31m281.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading termcolor-2.5.0-py3-none-any.whl (7.8 kB)\n",
      "Downloading wrapt-1.16.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (80 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m80.3/80.3 kB\u001b[0m \u001b[31m307.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading tensorboard_data_server-0.7.2-py3-none-manylinux_2_31_x86_64.whl (6.6 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m6.6/6.6 MB\u001b[0m \u001b[31m268.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading namex-0.0.8-py3-none-any.whl (5.8 kB)\n",
      "Installing collected packages: namex, libclang, flatbuffers, wrapt, termcolor, tensorflow-io-gcs-filesystem, tensorboard-data-server, numpy, google-pasta, tensorboard, ml-dtypes, h5py, keras, tensorflow\n",
      "  Attempting uninstall: tensorboard-data-server\n",
      "    Found existing installation: tensorboard-data-server 0.6.1\n",
      "    Uninstalling tensorboard-data-server-0.6.1:\n",
      "      Successfully uninstalled tensorboard-data-server-0.6.1\n",
      "  Attempting uninstall: numpy\n",
      "    Found existing installation: numpy 1.24.4\n",
      "    Uninstalling numpy-1.24.4:\n",
      "      Successfully uninstalled numpy-1.24.4\n",
      "  Attempting uninstall: tensorboard\n",
      "    Found existing installation: tensorboard 2.9.0\n",
      "    Uninstalling tensorboard-2.9.0:\n",
      "      Successfully uninstalled tensorboard-2.9.0\n",
      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
      "cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 2.0.2 which is incompatible.\n",
      "cupy-cuda12x 13.0.0 requires numpy<1.29,>=1.22, but you have numpy 2.0.2 which is incompatible.\n",
      "dask-cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 2.0.2 which is incompatible.\n",
      "lightning-thunder 0.1.0 requires numpy<2,>=1.23.0, but you have numpy 2.0.2 which is incompatible.\n",
      "numba 0.59.0+1.g20ae2b56c requires numpy<1.27,>=1.22, but you have numpy 2.0.2 which is incompatible.\n",
      "scipy 1.12.0 requires numpy<1.29.0,>=1.22.4, but you have numpy 2.0.2 which is incompatible.\n",
      "torchtext 0.17.0a0 requires torch==2.3.0a0+6ddf5cf, but you have torch 2.3.0a0+6ddf5cf85e.nv24.4 which is incompatible.\u001b[0m\u001b[31m\n",
      "\u001b[0mSuccessfully installed flatbuffers-24.3.25 google-pasta-0.2.0 h5py-3.12.1 keras-3.6.0 libclang-18.1.1 ml-dtypes-0.4.1 namex-0.0.8 numpy-2.0.2 tensorboard-2.18.0 tensorboard-data-server-0.7.2 tensorflow-2.18.0 tensorflow-io-gcs-filesystem-0.37.1 termcolor-2.5.0 wrapt-1.16.0\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n",
      "Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com\n",
      "Collecting numpy==1.26.4\n",
      "  Downloading numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (61 kB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m61.0/61.0 kB\u001b[0m \u001b[31m3.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m18.2/18.2 MB\u001b[0m \u001b[31m255.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: numpy\n",
      "  Attempting uninstall: numpy\n",
      "    Found existing installation: numpy 2.0.2\n",
      "    Uninstalling numpy-2.0.2:\n",
      "      Successfully uninstalled numpy-2.0.2\n",
      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
      "cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 1.26.4 which is incompatible.\n",
      "dask-cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 1.26.4 which is incompatible.\n",
      "torchtext 0.17.0a0 requires torch==2.3.0a0+6ddf5cf, but you have torch 2.3.0a0+6ddf5cf85e.nv24.4 which is incompatible.\u001b[0m\u001b[31m\n",
      "\u001b[0mSuccessfully installed numpy-1.26.4\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n",
      "Package                   Version                    Latest         Type\n",
      "------------------------- -------------------------- -------------- -----\n",
      "aiohttp                   3.9.3                      3.11.6         wheel\n",
      "annotated-types           0.6.0                      0.7.0          wheel\n",
      "anyio                     4.3.0                      4.6.2.post1    wheel\n",
      "async-timeout             4.0.3                      5.0.1          wheel\n",
      "attrs                     23.2.0                     24.2.0         wheel\n",
      "Babel                     2.15.0                     2.16.0         wheel\n",
      "bleach                    6.1.0                      6.2.0          wheel\n",
      "blis                      0.7.11                     1.0.1          wheel\n",
      "blosc2                    2.6.2                      2.7.1          wheel\n",
      "boto3                     1.34.104                   1.35.65        wheel\n",
      "botocore                  1.34.110                   1.35.65        wheel\n",
      "cachetools                5.3.3                      5.5.0          wheel\n",
      "certifi                   2024.2.2                   2024.8.30      wheel\n",
      "cffi                      1.16.0                     1.17.1         wheel\n",
      "charset-normalizer        3.3.2                      3.4.0          wheel\n",
      "cloudpathlib              0.16.0                     0.20.0         wheel\n",
      "cloudpickle               3.0.0                      3.1.0          wheel\n",
      "cmake                     3.29.0.1                   3.31.0.1       wheel\n",
      "confection                0.1.4                      0.1.5          wheel\n",
      "contourpy                 1.2.1                      1.3.1          wheel\n",
      "cuda-python               12.4.0rc7+3.ge75c8a9.dirty 12.6.2.post1   wheel\n",
      "cupy-cuda12x              13.0.0                     13.3.0         wheel\n",
      "Cython                    3.0.10                     3.0.11         wheel\n",
      "dask                      2024.1.1                   2024.11.2      wheel\n",
      "dask-cuda                 24.2.0                     24.10.0        wheel\n",
      "debugpy                   1.8.1                      1.8.8          wheel\n",
      "distributed               2024.1.1                   2024.11.2      wheel\n",
      "einops                    0.7.0                      0.8.0          wheel\n",
      "exceptiongroup            1.2.0                      1.2.2          wheel\n",
      "execnet                   2.0.2                      2.1.1          wheel\n",
      "executing                 2.0.1                      2.1.0          wheel\n",
      "expecttest                0.1.3                      0.2.1          wheel\n",
      "fastjsonschema            2.19.1                     2.20.0         wheel\n",
      "filelock                  3.13.3                     3.16.1         wheel\n",
      "flash-attn                2.4.2                      2.7.0.post2    sdist\n",
      "fonttools                 4.51.0                     4.55.0         wheel\n",
      "frozenlist                1.4.1                      1.5.0          wheel\n",
      "fsspec                    2024.2.0                   2024.10.0      wheel\n",
      "gast                      0.5.4                      0.6.0          wheel\n",
      "google-auth               2.29.0                     2.36.0         wheel\n",
      "google-auth-oauthlib      0.4.6                      1.2.1          wheel\n",
      "grpcio                    1.62.1                     1.68.0         wheel\n",
      "httpcore                  1.0.5                      1.0.7          wheel\n",
      "httpx                     0.27.0                     0.27.2         wheel\n",
      "huggingface-hub           0.23.0                     0.26.2         wheel\n",
      "hypothesis                5.35.1                     6.119.3        wheel\n",
      "idna                      3.6                        3.10           wheel\n",
      "igraph                    0.11.4                     0.11.8         wheel\n",
      "importlib_metadata        7.0.2                      8.5.0          wheel\n",
      "intel-openmp              2021.4.0                   2025.0.1       wheel\n",
      "ipykernel                 6.29.4                     6.29.5         wheel\n",
      "ipython                   8.21.0                     8.29.0         wheel\n",
      "ipywidgets                8.1.2                      8.1.5          wheel\n",
      "jedi                      0.19.1                     0.19.2         wheel\n",
      "Jinja2                    3.1.3                      3.1.4          wheel\n",
      "joblib                    1.3.2                      1.4.2          wheel\n",
      "json5                     0.9.24                     0.9.28         wheel\n",
      "jsonpointer               2.4                        3.0.0          wheel\n",
      "jsonschema                4.21.1                     4.23.0         wheel\n",
      "jsonschema-specifications 2023.12.1                  2024.10.1      wheel\n",
      "jupyter_client            8.6.1                      8.6.3          wheel\n",
      "jupyter_server            2.14.0                     2.14.2         wheel\n",
      "jupyterlab                4.2.0                      4.3.1          wheel\n",
      "jupyterlab_server         2.27.1                     2.27.3         wheel\n",
      "jupyterlab_widgets        3.0.10                     3.0.13         wheel\n",
      "jupytext                  1.16.1                     1.16.4         wheel\n",
      "kiwisolver                1.4.5                      1.4.7          wheel\n",
      "langcodes                 3.3.0                      3.5.0          wheel\n",
      "lark                      1.1.9                      1.2.2          wheel\n",
      "librosa                   0.10.1                     0.10.2.post1   wheel\n",
      "lightning-utilities       0.11.2                     0.11.9         wheel\n",
      "llvmlite                  0.42.0                     0.43.0         wheel\n",
      "Markdown                  3.6                        3.7            wheel\n",
      "MarkupSafe                2.1.5                      3.0.2          wheel\n",
      "matplotlib                3.8.4                      3.9.2          wheel\n",
      "matplotlib-inline         0.1.6                      0.1.7          wheel\n",
      "mdit-py-plugins           0.4.0                      0.4.2          wheel\n",
      "mkl                       2021.1.1                   2025.0.1       wheel\n",
      "mkl-devel                 2021.1.1                   2025.0.1       wheel\n",
      "mkl-include               2021.1.1                   2025.0.1       wheel\n",
      "ml-dtypes                 0.4.1                      0.5.0          wheel\n",
      "msgpack                   1.0.8                      1.1.0          wheel\n",
      "multidict                 6.0.5                      6.1.0          wheel\n",
      "nbconvert                 7.16.3                     7.16.4         wheel\n",
      "ndindex                   1.8                        1.9.2          wheel\n",
      "networkx                  2.6.3                      3.4.2          wheel\n",
      "notebook                  6.4.10                     7.2.2          wheel\n",
      "numba                     0.59.0+1.g20ae2b56c        0.60.0         wheel\n",
      "numexpr                   2.10.0                     2.10.1         wheel\n",
      "numpy                     1.26.4                     2.1.3          wheel\n",
      "nvidia-dali-cuda120       1.36.0                     1.43.0         wheel\n",
      "nvidia-nvimgcodec-cu12    0.2.0.7                    0.4.0.9        wheel\n",
      "nvtx                      0.2.5                      0.2.10         wheel\n",
      "onnx                      1.16.0                     1.17.0         wheel\n",
      "opencv-python             4.9.0.80                   4.10.0.84      wheel\n",
      "opt-einsum                3.3.0                      3.4.0          wheel\n",
      "optree                    0.11.0                     0.13.1         wheel\n",
      "packaging                 23.2                       24.2           wheel\n",
      "pandas                    1.5.3                      2.2.3          wheel\n",
      "partd                     1.4.1                      1.4.2          wheel\n",
      "pillow                    10.2.0                     11.0.0         wheel\n",
      "pip                       24.0                       24.3.1         wheel\n",
      "platformdirs              4.2.0                      4.3.6          wheel\n",
      "pluggy                    1.4.0                      1.5.0          wheel\n",
      "polygraphy                0.49.8                     0.49.9         wheel\n",
      "pooch                     1.8.1                      1.8.2          wheel\n",
      "prettytable               3.10.0                     3.12.0         wheel\n",
      "prometheus_client         0.20.0                     0.21.0         wheel\n",
      "prompt-toolkit            3.0.43                     3.0.48         wheel\n",
      "protobuf                  4.24.4                     5.28.3         wheel\n",
      "psutil                    5.9.4                      6.1.0          wheel\n",
      "pure-eval                 0.2.2                      0.2.3          wheel\n",
      "pyarrow                   14.0.1                     18.0.0         wheel\n",
      "pyasn1                    0.6.0                      0.6.1          wheel\n",
      "pyasn1_modules            0.4.0                      0.4.1          wheel\n",
      "pybind11                  2.12.0                     2.13.6         wheel\n",
      "pybind11_global           2.12.0                     2.13.6         wheel\n",
      "pycocotools               2.0+nv0.8.0                2.0.8          wheel\n",
      "pydantic                  2.6.4                      2.9.2          wheel\n",
      "pydantic_core             2.16.3                     2.27.0         wheel\n",
      "Pygments                  2.17.2                     2.18.0         wheel\n",
      "pynvml                    11.4.1                     11.5.3         wheel\n",
      "pyparsing                 3.1.2                      3.2.0          wheel\n",
      "pytest                    8.1.1                      8.3.3          wheel\n",
      "pytest-rerunfailures      14.0                       15.0           wheel\n",
      "pytest-xdist              3.5.0                      3.6.1          wheel\n",
      "python-hostlist           1.23.0                     2.0.0          sdist\n",
      "pytorch-quantization      2.1.2                      2.2.1          sdist\n",
      "pytz                      2024.1                     2024.2         wheel\n",
      "PyYAML                    6.0.1                      6.0.2          wheel\n",
      "pyzmq                     25.1.2                     26.2.0         wheel\n",
      "rapids-dask-dependency    24.2.0a0                   24.10.0        wheel\n",
      "referencing               0.34.0                     0.35.1         wheel\n",
      "regex                     2023.12.25                 2024.11.6      wheel\n",
      "requests                  2.31.0                     2.32.3         wheel\n",
      "rich                      13.7.1                     13.9.4         wheel\n",
      "rpds-py                   0.18.0                     0.21.0         wheel\n",
      "s3transfer                0.10.1                     0.10.3         wheel\n",
      "safetensors               0.4.3                      0.4.5          wheel\n",
      "scikit-learn              1.2.0                      1.5.2          wheel\n",
      "scipy                     1.12.0                     1.14.1         wheel\n",
      "Send2Trash                1.8.2                      1.8.3          wheel\n",
      "setuptools                68.2.2                     75.5.0         wheel\n",
      "smart-open                6.4.0                      7.0.5          wheel\n",
      "soupsieve                 2.5                        2.6            wheel\n",
      "soxr                      0.3.7                      0.5.0.post1    wheel\n",
      "spacy                     3.7.4                      3.8.2          wheel\n",
      "sympy                     1.12                       1.13.3         wheel\n",
      "tables                    3.9.2                      3.10.1         wheel\n",
      "tbb                       2021.12.0                  2022.0.0       wheel\n",
      "tensorrt                  8.6.3                      10.6.0         sdist\n",
      "thinc                     8.2.3                      9.1.1          wheel\n",
      "threadpoolctl             3.3.0                      3.5.0          wheel\n",
      "thriftpy2                 0.4.17                     0.5.2          sdist\n",
      "tinycss2                  1.2.1                      1.4.0          wheel\n",
      "tokenizers                0.19.1                     0.20.3         wheel\n",
      "tomli                     2.0.1                      2.1.0          wheel\n",
      "toolz                     0.12.1                     1.0.0          wheel\n",
      "torch                     2.3.0a0+6ddf5cf85e.nv24.4  2.5.1          wheel\n",
      "torch-tensorrt            2.3.0a0                    2.5.0          wheel\n",
      "torchdata                 0.7.1a0                    0.9.0          wheel\n",
      "torchtext                 0.17.0a0                   0.18.0         wheel\n",
      "torchvision               0.18.0a0                   0.20.1         wheel\n",
      "tornado                   6.4                        6.4.1          wheel\n",
      "tqdm                      4.42.1                     4.67.0         wheel\n",
      "traitlets                 5.9.0                      5.14.3         wheel\n",
      "transformer-engine        1.5.0+6a9edc3              1.11.0         wheel\n",
      "transformers              4.40.2                     4.46.3         wheel\n",
      "treelite                  4.0.0                      4.3.0          wheel\n",
      "typer                     0.9.4                      0.13.1         wheel\n",
      "types-python-dateutil     2.9.0.20240316             2.9.0.20241003 wheel\n",
      "typing_extensions         4.10.0                     4.12.2         wheel\n",
      "urllib3                   1.26.18                    2.2.3          wheel\n",
      "wasabi                    1.1.2                      1.1.3          wheel\n",
      "weasel                    0.3.4                      0.4.1          wheel\n",
      "webcolors                 1.13                       24.11.1        wheel\n",
      "Werkzeug                  3.0.2                      3.1.3          wheel\n",
      "wheel                     0.43.0                     0.45.0         wheel\n",
      "widgetsnbextension        4.0.10                     4.0.13         wheel\n",
      "xdoctest                  1.0.2                      1.2.0          wheel\n",
      "xgboost                   2.0.3                      2.1.2          wheel\n",
      "yarl                      1.9.4                      1.17.2         wheel\n",
      "zipp                      3.17.0                     3.21.0         wheel\n",
      "\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n",
      "/bin/bash: -c: line 1: syntax error near unexpected token `newline'\n",
      "/bin/bash: -c: line 1: `pip install --upgrade <package_name>'\n",
      "Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com\n",
      "Requirement already satisfied: pandas in /usr/local/lib/python3.10/dist-packages (1.5.3)\n",
      "Collecting pandas\n",
      "  Downloading pandas-2.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (89 kB)\n",
      "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m89.9/89.9 kB\u001b[0m \u001b[31m4.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hRequirement already satisfied: numpy>=1.22.4 in /usr/local/lib/python3.10/dist-packages (from pandas) (1.26.4)\n",
      "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.10/dist-packages (from pandas) (2.9.0.post0)\n",
      "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.10/dist-packages (from pandas) (2024.1)\n",
      "Collecting tzdata>=2022.7 (from pandas)\n",
      "  Downloading tzdata-2024.2-py2.py3-none-any.whl.metadata (1.4 kB)\n",
      "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.10/dist-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)\n",
      "Downloading pandas-2.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.1 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m13.1/13.1 MB\u001b[0m \u001b[31m208.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hDownloading tzdata-2024.2-py2.py3-none-any.whl (346 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m346.6/346.6 kB\u001b[0m \u001b[31m337.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: tzdata, pandas\n",
      "  Attempting uninstall: pandas\n",
      "    Found existing installation: pandas 1.5.3\n",
      "    Uninstalling pandas-1.5.3:\n",
      "      Successfully uninstalled pandas-1.5.3\n",
      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
      "cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 1.26.4 which is incompatible.\n",
      "cudf 24.2.0 requires pandas<1.6.0dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "dask-cuda 24.2.0 requires pandas<1.6.0.dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "dask-cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 1.26.4 which is incompatible.\n",
      "dask-cudf 24.2.0 requires pandas<1.6.0dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\u001b[0m\u001b[31m\n",
      "\u001b[0mSuccessfully installed pandas-2.2.3 tzdata-2024.2\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n",
      "Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com\n",
      "Collecting tensorflow==2.9.1\n",
      "  Downloading tensorflow-2.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (3.0 kB)\n",
      "Requirement already satisfied: absl-py>=1.0.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (2.1.0)\n",
      "Requirement already satisfied: astunparse>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (1.6.3)\n",
      "Collecting flatbuffers<2,>=1.12 (from tensorflow==2.9.1)\n",
      "  Downloading flatbuffers-1.12-py2.py3-none-any.whl.metadata (872 bytes)\n",
      "Collecting gast<=0.4.0,>=0.2.1 (from tensorflow==2.9.1)\n",
      "  Downloading gast-0.4.0-py3-none-any.whl.metadata (1.1 kB)\n",
      "Requirement already satisfied: google-pasta>=0.1.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (0.2.0)\n",
      "Requirement already satisfied: grpcio<2.0,>=1.24.3 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (1.62.1)\n",
      "Requirement already satisfied: h5py>=2.9.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (3.12.1)\n",
      "Collecting keras<2.10.0,>=2.9.0rc0 (from tensorflow==2.9.1)\n",
      "  Downloading keras-2.9.0-py2.py3-none-any.whl.metadata (1.3 kB)\n",
      "Collecting keras-preprocessing>=1.1.1 (from tensorflow==2.9.1)\n",
      "  Downloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl.metadata (1.9 kB)\n",
      "Requirement already satisfied: libclang>=13.0.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (18.1.1)\n",
      "Requirement already satisfied: numpy>=1.20 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (1.26.4)\n",
      "Requirement already satisfied: opt-einsum>=2.3.2 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (3.3.0)\n",
      "Requirement already satisfied: packaging in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (23.2)\n",
      "Collecting protobuf<3.20,>=3.9.2 (from tensorflow==2.9.1)\n",
      "  Downloading protobuf-3.19.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (787 bytes)\n",
      "Requirement already satisfied: setuptools in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (68.2.2)\n",
      "Requirement already satisfied: six>=1.12.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (1.16.0)\n",
      "Collecting tensorboard<2.10,>=2.9 (from tensorflow==2.9.1)\n",
      "  Downloading tensorboard-2.9.1-py3-none-any.whl.metadata (1.9 kB)\n",
      "Requirement already satisfied: tensorflow-io-gcs-filesystem>=0.23.1 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (0.37.1)\n",
      "Collecting tensorflow-estimator<2.10.0,>=2.9.0rc0 (from tensorflow==2.9.1)\n",
      "  Downloading tensorflow_estimator-2.9.0-py2.py3-none-any.whl.metadata (1.3 kB)\n",
      "Requirement already satisfied: termcolor>=1.1.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (2.5.0)\n",
      "Requirement already satisfied: typing-extensions>=3.6.6 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (4.10.0)\n",
      "Requirement already satisfied: wrapt>=1.11.0 in /usr/local/lib/python3.10/dist-packages (from tensorflow==2.9.1) (1.16.0)\n",
      "Requirement already satisfied: wheel<1.0,>=0.23.0 in /usr/local/lib/python3.10/dist-packages (from astunparse>=1.6.0->tensorflow==2.9.1) (0.43.0)\n",
      "Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.10,>=2.9->tensorflow==2.9.1) (2.29.0)\n",
      "Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.10,>=2.9->tensorflow==2.9.1) (0.4.6)\n",
      "Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.10,>=2.9->tensorflow==2.9.1) (3.6)\n",
      "Requirement already satisfied: requests<3,>=2.21.0 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.10,>=2.9->tensorflow==2.9.1) (2.31.0)\n",
      "Collecting tensorboard-data-server<0.7.0,>=0.6.0 (from tensorboard<2.10,>=2.9->tensorflow==2.9.1)\n",
      "  Downloading tensorboard_data_server-0.6.1-py3-none-manylinux2010_x86_64.whl.metadata (1.1 kB)\n",
      "Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.10,>=2.9->tensorflow==2.9.1) (1.8.1)\n",
      "Requirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.10/dist-packages (from tensorboard<2.10,>=2.9->tensorflow==2.9.1) (3.0.2)\n",
      "Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (5.3.3)\n",
      "Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (0.4.0)\n",
      "Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.10/dist-packages (from google-auth<3,>=1.6.3->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (4.9)\n",
      "Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.10/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (2.0.0)\n",
      "Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (3.3.2)\n",
      "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (3.6)\n",
      "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (1.26.18)\n",
      "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.10/dist-packages (from requests<3,>=2.21.0->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (2024.2.2)\n",
      "Requirement already satisfied: MarkupSafe>=2.1.1 in /usr/local/lib/python3.10/dist-packages (from werkzeug>=1.0.1->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (2.1.5)\n",
      "Requirement already satisfied: pyasn1<0.7.0,>=0.4.6 in /usr/local/lib/python3.10/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (0.6.0)\n",
      "Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.10/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard<2.10,>=2.9->tensorflow==2.9.1) (3.2.2)\n",
      "Downloading tensorflow-2.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (511.7 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m511.7/511.7 MB\u001b[0m \u001b[31m274.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m00:01\u001b[0m00:01\u001b[0m\n",
      "\u001b[?25hDownloading flatbuffers-1.12-py2.py3-none-any.whl (15 kB)\n",
      "Downloading gast-0.4.0-py3-none-any.whl (9.8 kB)\n",
      "Downloading keras-2.9.0-py2.py3-none-any.whl (1.6 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.6/1.6 MB\u001b[0m \u001b[31m266.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading Keras_Preprocessing-1.1.2-py2.py3-none-any.whl (42 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m42.6/42.6 kB\u001b[0m \u001b[31m223.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading protobuf-3.19.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.1 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m343.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading tensorboard-2.9.1-py3-none-any.whl (5.8 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m5.8/5.8 MB\u001b[0m \u001b[31m254.5 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading tensorflow_estimator-2.9.0-py2.py3-none-any.whl (438 kB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m438.7/438.7 kB\u001b[0m \u001b[31m346.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hDownloading tensorboard_data_server-0.6.1-py3-none-manylinux2010_x86_64.whl (4.9 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.9/4.9 MB\u001b[0m \u001b[31m248.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: keras, flatbuffers, tensorflow-estimator, tensorboard-data-server, protobuf, keras-preprocessing, gast, tensorboard, tensorflow\n",
      "  Attempting uninstall: keras\n",
      "    Found existing installation: keras 3.6.0\n",
      "    Uninstalling keras-3.6.0:\n",
      "      Successfully uninstalled keras-3.6.0\n",
      "  Attempting uninstall: flatbuffers\n",
      "    Found existing installation: flatbuffers 24.3.25\n",
      "    Uninstalling flatbuffers-24.3.25:\n",
      "      Successfully uninstalled flatbuffers-24.3.25\n",
      "  Attempting uninstall: tensorboard-data-server\n",
      "    Found existing installation: tensorboard-data-server 0.7.2\n",
      "    Uninstalling tensorboard-data-server-0.7.2:\n",
      "      Successfully uninstalled tensorboard-data-server-0.7.2\n",
      "  Attempting uninstall: protobuf\n",
      "    Found existing installation: protobuf 4.24.4\n",
      "    Uninstalling protobuf-4.24.4:\n",
      "      Successfully uninstalled protobuf-4.24.4\n",
      "  Attempting uninstall: gast\n",
      "    Found existing installation: gast 0.5.4\n",
      "    Uninstalling gast-0.5.4:\n",
      "      Successfully uninstalled gast-0.5.4\n",
      "  Attempting uninstall: tensorboard\n",
      "    Found existing installation: tensorboard 2.18.0\n",
      "    Uninstalling tensorboard-2.18.0:\n",
      "      Successfully uninstalled tensorboard-2.18.0\n",
      "  Attempting uninstall: tensorflow\n",
      "    Found existing installation: tensorflow 2.18.0\n",
      "    Uninstalling tensorflow-2.18.0:\n",
      "      Successfully uninstalled tensorflow-2.18.0\n",
      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
      "cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 1.26.4 which is incompatible.\n",
      "cudf 24.2.0 requires pandas<1.6.0dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "cudf 24.2.0 requires protobuf<5,>=4.21, but you have protobuf 3.19.6 which is incompatible.\n",
      "dask-cudf 24.2.0 requires numpy<1.25,>=1.21, but you have numpy 1.26.4 which is incompatible.\n",
      "dask-cudf 24.2.0 requires pandas<1.6.0dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "onnx 1.16.0 requires protobuf>=3.20.2, but you have protobuf 3.19.6 which is incompatible.\u001b[0m\u001b[31m\n",
      "\u001b[0mSuccessfully installed flatbuffers-1.12 gast-0.4.0 keras-2.9.0 keras-preprocessing-1.1.2 protobuf-3.19.6 tensorboard-2.9.1 tensorboard-data-server-0.6.1 tensorflow-2.9.1 tensorflow-estimator-2.9.0\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n",
      "Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com\n",
      "Requirement already satisfied: keras==2.9.0 in /usr/local/lib/python3.10/dist-packages (2.9.0)\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n",
      "Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com\n",
      "Collecting numpy==1.24.3\n",
      "  Downloading numpy-1.24.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB)\n",
      "Downloading numpy-1.24.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.3 MB)\n",
      "\u001b[2K   \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m17.3/17.3 MB\u001b[0m \u001b[31m227.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n",
      "\u001b[?25hInstalling collected packages: numpy\n",
      "  Attempting uninstall: numpy\n",
      "    Found existing installation: numpy 1.26.4\n",
      "    Uninstalling numpy-1.26.4:\n",
      "      Successfully uninstalled numpy-1.26.4\n",
      "\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
      "cudf 24.2.0 requires pandas<1.6.0dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "cudf 24.2.0 requires protobuf<5,>=4.21, but you have protobuf 3.19.6 which is incompatible.\n",
      "dask-cuda 24.2.0 requires pandas<1.6.0.dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "dask-cudf 24.2.0 requires pandas<1.6.0dev0,>=1.3, but you have pandas 2.2.3 which is incompatible.\n",
      "onnx 1.16.0 requires protobuf>=3.20.2, but you have protobuf 3.19.6 which is incompatible.\n",
      "torchtext 0.17.0a0 requires torch==2.3.0a0+6ddf5cf, but you have torch 2.3.0a0+6ddf5cf85e.nv24.4 which is incompatible.\u001b[0m\u001b[31m\n",
      "\u001b[0mSuccessfully installed numpy-1.24.3\n",
      "\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n",
      "\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m24.0\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.3.1\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython -m pip install --upgrade pip\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pip install tensorflow\n",
    "!pip install numpy==1.26.4\n",
    "!pip list --outdated\n",
    "!pip install --upgrade <package_name>\n",
    "!pip install pandas --upgrade\n",
    "!pip install tensorflow==2.9.1\n",
    "!pip install keras==2.9.0\n",
    "!pip install numpy==1.24.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "3a9d7a5c-950b-4fa4-807c-112a60d5f65f",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"model_1\"\n",
      "_________________________________________________________________\n",
      " Layer (type)                Output Shape              Param #   \n",
      "=================================================================\n",
      " input_4 (InputLayer)        [(None, 224, 224, 3)]     0         \n",
      "                                                                 \n",
      " vgg16 (Functional)          (None, 7, 7, 512)         14714688  \n",
      "                                                                 \n",
      " global_average_pooling2d_1   (None, 512)              0         \n",
      " (GlobalAveragePooling2D)                                        \n",
      "                                                                 \n",
      " dense_1 (Dense)             (None, 6)                 3078      \n",
      "                                                                 \n",
      "=================================================================\n",
      "Total params: 14,717,766\n",
      "Trainable params: 3,078\n",
      "Non-trainable params: 14,714,688\n",
      "_________________________________________________________________\n",
      "Found 1182 images belonging to 6 classes.\n",
      "Found 329 images belonging to 6 classes.\n",
      "Epoch 1/10\n",
      "36/36 [==============================] - 179s 5s/step - loss: 3.6548 - accuracy: 0.3367 - val_loss: 1.5404 - val_accuracy: 0.5988\n",
      "Epoch 2/10\n",
      "36/36 [==============================] - 179s 5s/step - loss: 0.9268 - accuracy: 0.7250 - val_loss: 0.6555 - val_accuracy: 0.7812\n",
      "Epoch 3/10\n",
      "36/36 [==============================] - 179s 5s/step - loss: 0.5289 - accuracy: 0.8342 - val_loss: 0.4674 - val_accuracy: 0.8207\n",
      "Epoch 4/10\n",
      "36/36 [==============================] - 178s 5s/step - loss: 0.3716 - accuracy: 0.8756 - val_loss: 0.3670 - val_accuracy: 0.8632\n",
      "Epoch 5/10\n",
      "36/36 [==============================] - 178s 5s/step - loss: 0.2455 - accuracy: 0.9154 - val_loss: 0.2673 - val_accuracy: 0.8997\n",
      "Epoch 6/10\n",
      "36/36 [==============================] - 177s 5s/step - loss: 0.2022 - accuracy: 0.9306 - val_loss: 0.2634 - val_accuracy: 0.9119\n",
      "Epoch 7/10\n",
      "36/36 [==============================] - 178s 5s/step - loss: 0.1812 - accuracy: 0.9382 - val_loss: 0.2125 - val_accuracy: 0.9271\n",
      "Epoch 8/10\n",
      "36/36 [==============================] - 178s 5s/step - loss: 0.1394 - accuracy: 0.9501 - val_loss: 0.2221 - val_accuracy: 0.9271\n",
      "Epoch 9/10\n",
      "36/36 [==============================] - 178s 5s/step - loss: 0.1107 - accuracy: 0.9594 - val_loss: 0.1394 - val_accuracy: 0.9635\n",
      "Epoch 10/10\n",
      "36/36 [==============================] - 178s 5s/step - loss: 0.1003 - accuracy: 0.9687 - val_loss: 0.1867 - val_accuracy: 0.9331\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "<keras.callbacks.History at 0x7f9d04f1c880>"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "from tensorflow import keras\n",
    "\n",
    "# 设置默认设备为GPU\n",
    "gpus = tf.config.experimental.list_physical_devices('GPU')\n",
    "if gpus:\n",
    "    try:\n",
    "        for gpu in gpus:\n",
    "            tf.config.experimental.set_memory_growth(gpu, True)\n",
    "        tf.config.experimental.set_visible_devices(gpus[0], 'GPU')\n",
    "    except RuntimeError as e:\n",
    "        print(e)\n",
    "\n",
    "# 加载预训练的VGG16模型\n",
    "base_model = keras.applications.VGG16(\n",
    "    weights=\"imagenet\",\n",
    "    input_shape=(224, 224, 3),\n",
    "    include_top=False\n",
    ")\n",
    "\n",
    "# 冻结基础模型\n",
    "base_model.trainable = False\n",
    "\n",
    "# 创建输入层\n",
    "inputs = keras.Input(shape=(224, 224, 3))\n",
    "\n",
    "x = base_model(inputs, training=False)\n",
    "\n",
    "# 添加池化层或展平层\n",
    "x = keras.layers.GlobalAveragePooling2D()(x)\n",
    "\n",
    "# 添加最终的全连接层\n",
    "outputs = keras.layers.Dense(6, activation='softmax')(x)\n",
    "\n",
    "# 组合输入和输出创建模型\n",
    "model = keras.Model(inputs, outputs)\n",
    "\n",
    "model.summary()\n",
    "\n",
    "model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])\n",
    "\n",
    "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
    "\n",
    "# 创建数据生成器\n",
    "datagen = ImageDataGenerator(\n",
    "    featurewise_center=True,  # 将输入均值设为0\n",
    "    samplewise_center=True,  # 将每个样本均值设为0\n",
    "    rotation_range=10,  # 随机旋转图像（角度范围0到180）\n",
    "    zoom_range=0.1,  # 随机缩放图像\n",
    "    width_shift_range=0.1,  # 随机水平平移图像（总宽度的百分比）\n",
    "    height_shift_range=0.1,  # 随机垂直平移图像（总高度的百分比）\n",
    "    horizontal_flip=True,  # 随机水平翻转图像\n",
    "    vertical_flip=False  # 不垂直翻转图像\n",
    ")\n",
    "\n",
    "# 加载和迭代训练数据集\n",
    "train_it = datagen.flow_from_directory(\"data/fruits/train\", \n",
    "                                       target_size=(224, 224), \n",
    "                                       color_mode='rgb', \n",
    "                                       class_mode=\"categorical\")\n",
    "\n",
    "# 加载和迭代验证数据集\n",
    "valid_it = datagen.flow_from_directory(\"data/fruits/valid\", \n",
    "                                       target_size=(224, 224), \n",
    "                                       color_mode='rgb', \n",
    "                                       class_mode=\"categorical\")\n",
    "\n",
    "# 训练模型\n",
    "model.fit(train_it,\n",
    "          validation_data=valid_it,\n",
    "          steps_per_epoch=train_it.samples/train_it.batch_size,\n",
    "          validation_steps=valid_it.samples/valid_it.batch_size,\n",
    "          epochs=10)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "8548d904-39fe-4898-b5b0-a3bb146a9f3b",
   "metadata": {},
   "outputs": [],
   "source": [
    "from run_assessment import run_assessment"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "0ed392b2-4301-4de0-9684-a1e142e6f8eb",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Evaluating model to obtain average accuracy...\n",
      "\n"
     ]
    },
    {
     "ename": "AttributeError",
     "evalue": "'Functional' object has no attribute 'eval'",
     "output_type": "error",
     "traceback": [
      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[0;31mAttributeError\u001b[0m                            Traceback (most recent call last)",
      "Cell \u001b[0;32mIn[10], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m \u001b[43mrun_assessment\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbase_model\u001b[49m\u001b[43m)\u001b[49m\n",
      "File \u001b[0;32m/dli/assessment/notebook_helpers/run_assessment.py:63\u001b[0m, in \u001b[0;36mrun_assessment\u001b[0;34m(model)\u001b[0m\n\u001b[1;32m     61\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mrun_assessment\u001b[39m(model):\n\u001b[1;32m     62\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mEvaluating model to obtain average accuracy...\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m---> 63\u001b[0m     average \u001b[38;5;241m=\u001b[39m \u001b[43mvalidate\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmodel\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m     64\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124mAccuracy required to pass the assessment is 0.92 or greater.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m     65\u001b[0m     \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mYour average accuracy is \u001b[39m\u001b[38;5;132;01m{:5.4f}\u001b[39;00m\u001b[38;5;124m.\u001b[39m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m.\u001b[39mformat(average))\n",
      "File \u001b[0;32m/dli/assessment/notebook_helpers/run_assessment.py:53\u001b[0m, in \u001b[0;36mvalidate\u001b[0;34m(model)\u001b[0m\n\u001b[1;32m     50\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mvalidate\u001b[39m(model):\n\u001b[1;32m     51\u001b[0m     accuracy \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m---> 53\u001b[0m     \u001b[43mmodel\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43meval\u001b[49m()\n\u001b[1;32m     54\u001b[0m     \u001b[38;5;28;01mwith\u001b[39;00m torch\u001b[38;5;241m.\u001b[39mno_grad():\n\u001b[1;32m     55\u001b[0m         \u001b[38;5;28;01mfor\u001b[39;00m x, y \u001b[38;5;129;01min\u001b[39;00m valid_loader:\n",
      "\u001b[0;31mAttributeError\u001b[0m: 'Functional' object has no attribute 'eval'"
     ]
    }
   ],
   "source": [
    "run_assessment(base_model)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "65450c88-7224-44d8-9884-92f4190ef0ab",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Model: \"model_2\"\n",
      "_________________________________________________________________\n",
      " Layer (type)                Output Shape              Param #   \n",
      "=================================================================\n",
      " input_6 (InputLayer)        [(None, 224, 224, 3)]     0         \n",
      "                                                                 \n",
      " vgg16 (Functional)          (None, 7, 7, 512)         14714688  \n",
      "                                                                 \n",
      " global_average_pooling2d_2   (None, 512)              0         \n",
      " (GlobalAveragePooling2D)                                        \n",
      "                                                                 \n",
      " dense_2 (Dense)             (None, 6)                 3078      \n",
      "                                                                 \n",
      "=================================================================\n",
      "Total params: 14,717,766\n",
      "Trainable params: 3,078\n",
      "Non-trainable params: 14,714,688\n",
      "_________________________________________________________________\n",
      "Found 1182 images belonging to 6 classes.\n",
      "Found 329 images belonging to 6 classes.\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.10/dist-packages/keras/preprocessing/image.py:1663: UserWarning: This ImageDataGenerator specifies `featurewise_center`, but it hasn't been fit on any training data. Fit it first by calling `.fit(numpy_data)`.\n",
      "  warnings.warn('This ImageDataGenerator specifies '\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Epoch 1/10\n",
      "36/36 [==============================] - 180s 5s/step - loss: 2.7402 - accuracy: 0.4408 - val_loss: 1.0660 - val_accuracy: 0.6930\n",
      "Epoch 2/10\n",
      " 5/36 [===>..........................] - ETA: 1:59 - loss: 0.9877 - accuracy: 0.7312"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "from tensorflow import keras\n",
    "from tensorflow.keras.preprocessing.image import ImageDataGenerator\n",
    "\n",
    "# 设置默认设备为GPU\n",
    "gpus = tf.config.experimental.list_physical_devices('GPU')\n",
    "if gpus:\n",
    "    try:\n",
    "        for gpu in gpus:\n",
    "            tf.config.experimental.set_memory_growth(gpu, True)\n",
    "        tf.config.experimental.set_visible_devices(gpus[0], 'GPU')\n",
    "    except RuntimeError as e:\n",
    "        print(e)\n",
    "\n",
    "# 加载预训练的VGG16模型\n",
    "base_model = keras.applications.VGG16(\n",
    "    weights=\"imagenet\",\n",
    "    input_shape=(224, 224, 3),\n",
    "    include_top=False\n",
    ")\n",
    "\n",
    "# 冻结基础模型\n",
    "base_model.trainable = False\n",
    "\n",
    "# 创建输入层\n",
    "inputs = keras.Input(shape=(224, 224, 3))\n",
    "\n",
    "x = base_model(inputs, training=False)\n",
    "\n",
    "# 添加池化层或展平层\n",
    "x = keras.layers.GlobalAveragePooling2D()(x)\n",
    "\n",
    "# 添加最终的全连接层\n",
    "outputs = keras.layers.Dense(6, activation='softmax')(x)\n",
    "\n",
    "# 组合输入和输出创建模型\n",
    "model = keras.Model(inputs, outputs)\n",
    "\n",
    "model.summary()\n",
    "\n",
    "model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])\n",
    "\n",
    "# 创建数据生成器\n",
    "datagen = ImageDataGenerator(\n",
    "    featurewise_center=True,  # 将输入均值设为0\n",
    "    samplewise_center=True,  # 将每个样本均值设为0\n",
    "    rotation_range=10,  # 随机旋转图像（角度范围0到180）\n",
    "    zoom_range=0.1,  # 随机缩放图像\n",
    "    width_shift_range=0.1,  # 随机水平平移图像（总宽度的百分比）\n",
    "    height_shift_range=0.1,  # 随机垂直平移图像（总高度的百分比）\n",
    "    horizontal_flip=True,  # 随机水平翻转图像\n",
    "    vertical_flip=False  # 不垂直翻转图像\n",
    ")\n",
    "\n",
    "# 加载和迭代训练数据集\n",
    "train_it = datagen.flow_from_directory(\"data/fruits/train\", \n",
    "                                       target_size=(224, 224), \n",
    "                                       color_mode='rgb', \n",
    "                                       class_mode=\"categorical\")\n",
    "\n",
    "# 加载和迭代验证数据集\n",
    "valid_it = datagen.flow_from_directory(\"data/fruits/valid\", \n",
    "                                       target_size=(224, 224), \n",
    "                                       color_mode='rgb', \n",
    "                                       class_mode=\"categorical\")\n",
    "\n",
    "# 训练模型\n",
    "model.fit(train_it,\n",
    "          validation_data=valid_it,\n",
    "          steps_per_epoch=train_it.samples/train_it.batch_size,\n",
    "          validation_steps=valid_it.samples/valid_it.batch_size,\n",
    "          epochs=10)\n",
    "\n",
    "# 评估模型\n",
    "loss, accuracy = model.evaluate(valid_it)\n",
    "print(f'Accuracy: {accuracy:.4f}')\n",
    "print('Accuracy required to pass the assessment is 0.92 or greater.')\n",
    "print(f'Your average accuracy is {accuracy:.4f}.')\n",
    "if accuracy < 0.92:\n",
    "    print('Your accuracy is not yet high enough to pass the assessment, please continue trying.')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6cc50cb3-b6e7-43aa-874c-bef588664317",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
